#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct Stu
{
	char name[20];
	int age;
}Stu;

int cmpbyname(const void* p1, const void* p2)
{
	return strcmp(((Stu*)p1)->name, ((Stu*)p2)->name);
}
void test()
{
	Stu s[3] = { {"zhangsan",21},{"lisi",28},{"wangwu",16} };
	qsort(s, 3, sizeof(Stu), cmpbyname);
	
}
int cmpbyage(const void* p1, const void* p2)
{
	return ((Stu*)p1)->age - ((Stu*)p2)->age;
}
void test1()
{
	Stu s[3] = { {"zhangsan",21},{"lisi",28},{"wangwu",16} };
	qsort(s, 3, sizeof(Stu), cmpbyage);
	
}

int main()
{

	//test();
	test1();
	return 0;
}